<?php
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'basic';
$return=array();
/*******basic*******/
if($_RQ['op']=='basic'){
	if($_RQ['postdata']){
		$postdata=get_postdata();
		$this->plugin_setting('basic',$postdata);
		exi('设置成功');
	}
	$footernav =array(
		array('title'=>'养老中心','icon'=>'icon-shouye','action'=>'jy_weishoppension/index/'),
		array('title'=>'养老金','icon'=>'icon-yiban','action'=>'jy_weishoppension/commission/'),
		array('title'=>'养老订单','icon'=>'icon-dingdan','action'=>'jy_weishoppension/order/'),
		array('title'=>'结算明细','icon'=>'icon-dingdan','action'=>'jy_weishoppension/balance/'),
	);
	$return['item']=$this->plugin_setting('basic');
	$return['item']['footernav']=$return['item']['footernav']?:$footernav;
	$htmls=array(
		'type'=>'edit',
		'desc'=>'参数设置',
		'edit_tab'=>true,
		'edits'=>array(
			array(
				'title'=>'基本设置',
				'list'=>array(
					array('type'=>'switch','title'=>'开启养老金？','name'=>'isopen','help'=>'会员自购商品订单，享有养老金，计算方式如下；按商品利润：【实际成交价-成本】×百分比①、实际成交价选项：含余额抵扣；不含余额抵扣；②、说明：除去运费、优惠券、积分抵扣；'),
					array('type'=>'checkbox','title'=>'升级考核指标','name'=>'level_up_types','options'=>'leveltype'),
					array('name'=>'commissiontype','title'=>'默认佣金计算方式','type'=>'radio','help'=>'第一种：按商品实际成交价×百分比,说明：①、实际成交价含余额抵扣；②、实际成交价减去运费、优惠券、积分抵扣；第二种：按商品利润：【实际成交价-成本】×百分比,说明：①、实际成交价含余额抵扣；②、实际成交价除去运费、优惠券、积分抵扣；','options'=>'commissiontypes'),
				)
			),
			array(
				'title'=>'结算设置',
				'list'=>array(
					array('type'=>'string','title'=>'养老金提取手续费（%）','name'=>'balance_per'),
					array('type'=>'string','title'=>'最低提取金额','name'=>'balance_money'),
					array('type'=>'string','title'=>'结算天数','name'=>'balance_day','help'=>'当订单完成后的n天后，订单才能申请结算,设置0或空，订单完成就可以结算'),
				),
			),
			array(
				'title'=>'底部导航',
					'list'=>array(
									array('type'=>'array','name'=>'footernav','add_tip'=>'添加一个底部导航',
									'list'=>array(
										array('type'=>'string','name'=>'title','title'=>'导航名称'),
										array('type'=>'icon','name'=>'icon','from'=>'jinyunicon','title'=>'导航图标'),
										array('type'=>'string','name'=>'action','title'=>'导航链接'),							
									),
									'details'=>array(
										array('type'=>'string','name'=>'title','title'=>'导航名称'),
										array('type'=>'icon','name'=>'icon','from'=>'jinyunicon','title'=>'导航图标','help'=>'图标，例如：icon-shouye'),							
										array('type'=>'link','name'=>'action','from'=>'action','title'=>'导航链接'),
									)
								),
					)
			),
		),
	);
	$return['leveltype']=$this->level_up_types;
	$return['levels']=$this->getall('level',array('uniacid'=>$_SESSION['uniacid']),array('id','title'),'id');
	$return['levels']['0']=array('id'=>0,'title'=>'默认等级');
	foreach($return['levels'] as &$lv){
		$htmls['edits'][0]['list'][]=array('type'=>'string','name'=>'commissions.commission'.$lv['id'],'title'=>$lv['title'].'佣金','help'=>'填写数字表示实际佣金金额，填写百分数表示比例。例如填写1表示发放1元佣金，填写1%表示发放商品价格1%的佣金');
	}
	$return['commissiontypes']=$this->commission_types;
	$return['htmls']=$htmls;
	exi($return);
}
/*******basic*******/
/*******op*******/
